<?php

//by ralvear 2013-08-09

class Peticion
{

	private $_controlador;
	private $_metodo;
	private $_args;

	public function __construct () {


		if( isset($_GET['url']) )
		{

			$url = filter_input( INPUT_GET , 'url' , FILTER_SANITIZE_URL);
			$url = explode( '/' , $url );
			$url = array_filter( $url );

			$this->_controlador = strtolower( array_shift( $url ) );
			$this->_metodo = strtolower( array_shift( $url ) );
			$this->_args = $url;

		}

		if( !$this->_controlador ) 
			$this->_controlador = CONTROL_DEFECTO;

		if( !$this->_metodo )
			$this->_metodo = METODO_DEFECTO;

		if( !isset( $this->_args ) )
			$this->_args = array();
	}

	public function obtenerControlador()
	{
		return $this->_controlador;
	}

	public function obtenerMetodo()
	{
		return $this->_metodo;
	}

	public function obtenerArgs()
	{
		return $this->_args;
	}

}

?>